package hong.helloWorld.objectWrapperFactory;

import hong.helloWorld.orm.entity.upms.User;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.ibatis.reflection.wrapper.BeanWrapper;
import org.apache.ibatis.reflection.wrapper.ObjectWrapper;
import org.apache.ibatis.reflection.wrapper.ObjectWrapperFactory;

public class MyObjectWrapperFactory implements ObjectWrapperFactory {


    @Override
    public boolean hasWrapperFor(Object object) {
        if (object instanceof User) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public ObjectWrapper getWrapperFor(MetaObject metaObject, Object object) {


        if (object instanceof User) {
            return new BeanWrapper(metaObject, object);
        }


        return null;
    }
}
